package com.tanhua.server.service;

import com.tanhua.dubbo.api.UserLocationApi;
import com.tanhua.server.interceptor.UserHolder;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

/**
 * @author liuyp
 * @date 2021/02/05
 */
@Service
public class BaiduService {
    @Reference
    private UserLocationApi userLocationApi;
    /**
     * 保存地理位置
     * @param longitude 经度
     * @param latitude 纬度
     * @param address 位置名称
     */
    public ResponseEntity saveLocation(Double longitude, Double latitude, String address) {
        //1.保存地理位置
        userLocationApi.save(UserHolder.getUserId(), longitude, latitude, address);
        //2.返回结果
        return ResponseEntity.ok(null);
    }
}
